﻿<UserControl x:Class="BYS.XiAnComDept.App.Pages.FundEdit"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="600">
    <Grid Style="{StaticResource ContentRoot}" Name="GridForm">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="7*"/>
            <ColumnDefinition Width="277*"/>
        </Grid.ColumnDefinitions>
        <ScrollViewer Grid.ColumnSpan="2">
            <StackPanel MinWidth="200">
                <TextBlock Name="TextTitle" Text="资金信息修改" Style="{StaticResource Heading2}" />
                <Grid HorizontalAlignment="Left">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition MinWidth="120" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition Height="150" />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition  Height="210" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.Resources>
                        <Style TargetType="RowDefinition">
                            <Setter Property="Height" Value="30"></Setter>
                        </Style>
                        <Style TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
                            <Setter Property="Height" Value="22" />
                            <Setter Property="Width" Value="500"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationTemplate}" />
                        </Style>
                        <Style TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
                            <Setter Property="Height" Value="22" />
                            <Setter Property="Width" Value="500"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationTemplate}" />
                        </Style>
                        <Style TargetType="TextBlock">
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </Grid.Resources>
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="单　　位："></TextBlock>
                    <ComboBox Grid.Row="0" Grid.Column="1" Name="ComboBoxCom" 
                              SelectedValue="{Binding Path=Company, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}">
                    </ComboBox>
                    <TextBlock Grid.Row="1" Grid.Column="0"  Text="年　　度："></TextBlock>
                    <ComboBox Grid.Row="1" Grid.Column="1"  Name="ComboBoxYear"
                              SelectedValue="{Binding Path=Year, Converter={StaticResource Year}, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}" SelectionChanged="ComboBoxYear_SelectionChanged"
                              ></ComboBox>
                    <TextBlock Grid.Row="2" Grid.Column="0"    Text="项目类型："></TextBlock>
                    <ComboBox Grid.Row="2" Grid.Column="1"   Name="ComboBoxFundType" 
                              SelectionChanged="ComboBoxFundType_SelectionChanged"
                              SelectedValue="{Binding Path=FundType, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}"></ComboBox>
                    <TextBlock Grid.Row="3" Grid.Column="0"    Text="项目信息："></TextBlock>
                    <ScrollViewer Grid.Row="3" Grid.Column="1">
                        <StackPanel>
                            <DataGrid  Name="DataGridFields" AutoGenerateColumns="False" IsReadOnly="True"
                                       ItemsSource="{Binding Path=ProjectFields}">
                                <DataGrid.Columns>
                                    <DataGridTextColumn Binding="{Binding Path=FieldName}" Header="项目属性"/>
                                    <DataGridTextColumn Binding="{Binding Path=FieldValue}" Header="数值"/>
                                    <DataGridTemplateColumn>
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button Name="ButtonDeleteField" Content="删除" Style="{StaticResource LinkButton}"  Click="ButtonDeleteField_Click" ></Button>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                </DataGrid.Columns>
                            </DataGrid >
                            <StackPanel Orientation="Horizontal">
                                <ComboBox Name="ComboBoxProjectFieldName" Width="100"></ComboBox>
                                <Button Name="ButtonAddField" Content="添加" Width="100" Margin="50,0,0,0" Click="ButtonAddField_Click"></Button>
                            </StackPanel>
                        </StackPanel>
                    </ScrollViewer>
                    <TextBlock Grid.Row="4" Grid.Column="0"    Text="申请状态："></TextBlock>
                    <ComboBox Grid.Row="4" Grid.Column="1"   Name="ComboBoxStatus"
                              SelectedValue="{Binding Path=FundStatus, Converter={StaticResource Trim}, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}"></ComboBox>
                    <TextBlock  Grid.Row="5" Grid.Column="0"   Text="申报金额："></TextBlock>
                    <TextBox Grid.Row="5" Grid.Column="1"   Name="TextAmount" 
                             Text="{Binding Path=Amount,UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True, ValidatesOnExceptions=False}"></TextBox>
                    <TextBlock  Grid.Row="6" Grid.Column="0"   Text="审核金额："></TextBlock>
                    <TextBox Grid.Row="6" Grid.Column="1"   Name="TextApprovedAmount" 
                             Text="{Binding Path=ApprovedAmount,UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True, ValidatesOnExceptions=False}"></TextBox>
                    <TextBlock Grid.Row="7" Grid.Column="0"    Text="尾　　款："></TextBlock>
                    <TextBox Grid.Row="7" Grid.Column="1"   Name="TextDueAmount"
                             Text="{Binding Path=DueAmount, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True, ValidatesOnExceptions=False}"></TextBox>
                    <TextBlock Grid.Row="8" Grid.Column="0"    Text="备　　注："></TextBlock>
                    <TextBox Grid.Row="8" Grid.Column="1"   Name="TextComment" Width="500" Height="200" Margin="0,0,0,-80" Grid.RowSpan="4" VerticalAlignment="Top"
                             Text="{Binding Path=Comment, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}"
                             MaxLength="2000"></TextBox>
                    <Button Grid.Row="9" Grid.Column="1"   Name="ButtonSave" Content="保存" Width="100" Margin="-150,0,0,0" Click="ButtonSave_Click"></Button>
                    <Button Grid.Row="9" Grid.Column="1"   Name="ButtonDelete" Content="删除" Width="100" Margin="150,0,0,0" Click="ButtonDelete_Click"></Button>
                </Grid>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
